package com.linkoog.devtools.http.document.markdown;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.linkoog.devtools.http.raw_index.HttpServiceMethod;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

public class MarkdownPreviewAction extends AnAction {

    private final HttpServiceMethod httpServiceMethod;

    public MarkdownPreviewAction(@NotNull HttpServiceMethod httpServiceMethod, @NotNull String text, String description, Icon icon) {
        super(text, description, icon);
        this.httpServiceMethod = httpServiceMethod;
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent event) {
        Project project = event.getData(CommonDataKeys.PROJECT);
        if (project == null){
            return;
        }

        Module module = event.getData(LangDataKeys.MODULE);
        if (module == null){
            return;
        }

        //对话框
        /*MarkdownPreviewDialog dialog = null;
        try {
            dialog = new MarkdownPreviewDialog(httpServiceMethod, project);
            dialog.showAndGet();
        } catch (Exception e) {
            e.printStackTrace();
        }*/
    }



}
